<template>
  <div class="user-center-container">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="header-content">
        <h1 class="page-title">个人中心</h1>
        <p class="page-subtitle">管理您的个人信息和账户设置</p>
      </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <a-row :gutter="24">
        <!-- 左侧导航菜单 -->
        <a-col :span="6">
          <div class="sidebar-menu">
            <a-menu
              v-model:selectedKeys="selectedKeys"
              mode="inline"
              class="user-menu"
              @click="handleMenuClick"
            >
              <a-menu-item key="profile">
                <UserOutlined />
                <span>个人信息</span>
              </a-menu-item>
              <a-menu-item key="security">
                <SafetyOutlined />
                <span>安全设置</span>
              </a-menu-item>
              <a-menu-item key="help">
                <QuestionCircleOutlined />
                <span>帮助中心</span>
              </a-menu-item>
              <a-menu-item key="feedback">
                <MessageOutlined />
                <span>反馈建议</span>
              </a-menu-item>
              <a-menu-item key="about">
                <InfoCircleOutlined />
                <span>关于更新</span>
              </a-menu-item>
            </a-menu>
          </div>
        </a-col>

        <!-- 右侧内容区域 -->
        <a-col :span="18">
          <div class="content-area">
            <!-- 个人信息管理 -->
            <div v-if="activeTab === 'profile'" class="content-section">
              <ProfileSection />
            </div>

            <!-- 安全设置 -->
            <div v-if="activeTab === 'security'" class="content-section">
              <SecuritySection />
            </div>

            <!-- 帮助中心 -->
            <div v-if="activeTab === 'help'" class="content-section">
              <HelpSection />
            </div>

            <!-- 反馈建议 -->
            <div v-if="activeTab === 'feedback'" class="content-section">
              <FeedbackSection />
            </div>

            <!-- 关于更新 -->
            <div v-if="activeTab === 'about'" class="content-section">
              <AboutSection />
            </div>
          </div>
        </a-col>
      </a-row>
    </div>
  </div>
  <ToTop></ToTop>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import {
  UserOutlined,
  SafetyOutlined,
  QuestionCircleOutlined,
  MessageOutlined,
  InfoCircleOutlined,
} from '@ant-design/icons-vue'
import ProfileSection from '@/components/user-center/ProfileSection.vue'
import SecuritySection from '@/components/user-center/SecuritySection.vue'
import HelpSection from '@/components/user-center/HelpSection.vue'
import FeedbackSection from '@/components/user-center/FeedbackSection.vue'
import AboutSection from '@/components/user-center/AboutSection.vue'
import ToTop from '@/components/ToTop.vue'

const selectedKeys = ref(['profile'])
const activeTab = ref('profile')

const handleMenuClick = ({ key }: { key: string }) => {
  activeTab.value = key
  selectedKeys.value = [key]
}
</script>

<style scoped>
.user-center-container {
  min-height: 100vh;
  background: #f5f7fa;
}

.page-header {
  background: linear-gradient(135deg, #20a1da 0%, #30a4ad 100%);
  color: white;
  padding: 20px 0;
  margin-bottom: 24px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-title {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: white;
}

.page-subtitle {
  font-size: 16px;
  margin: 0;
  opacity: 0.9;
}

.main-content {

  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.sidebar-menu {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.user-menu {
  border: none;
}

:deep(.ant-menu-item) {
  height: 56px !important;
  line-height: 56px !important;
  font-size: 16px;
  margin: 0 !important;
  border-radius: 0 !important;

  &:hover {
    background: #f0f8ff !important;
    color: #20a1da !important;
  }

  &.ant-menu-item-selected {
    background: linear-gradient(135deg, #20a1da 0%, #30a4ad 100%) !important;
    color: white !important;

    &::after {
      display: none;
    }
  }
}

:deep(.ant-menu-item .anticon) {
  font-size: 18px;
  margin-right: 12px;
}

.content-area {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-height: 600px;
}

.content-section {
  padding: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-header {
    padding: 24px 0;
  }

  .page-title {
    font-size: 24px;
  }

  .main-content {
    padding: 0 12px 24px;
  }

  :deep(.ant-col) {
    width: 100% !important;
    margin-bottom: 16px;
  }

  .sidebar-menu {
    margin-bottom: 16px;
  }

  :deep(.ant-menu-item) {
    height: 48px !important;
    line-height: 48px !important;
    font-size: 14px;
  }
}
</style>
